package com.example.zhaohang.utils;

import android.support.v4.app.Fragment;

/**
 * Created by 赵航 on 2017/11/19.
 */

public class FragmentUtils {

    private static OneFragmet mOneFragmet = null;
    private static TwoFragmet    mTwoFragmet    = null;
    private static ThreadFragmet mThreadFragmet = null;

    public static  Fragment provideFrage(int position) {
        if (position == 0) {
            if (mOneFragmet == null) {
                mOneFragmet = new OneFragmet();
            }
            return mOneFragmet;
        }
        if (position == 1) {
            if (mTwoFragmet == null) {
                mTwoFragmet = new TwoFragmet();
            }
            return mTwoFragmet;
        }
        if (position == 2) {
            if (mThreadFragmet == null) {
                mThreadFragmet = new ThreadFragmet();
            }
            return mThreadFragmet;
        }
        return null;
    }
}
